/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.myapp.struts;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.upload.FormFile;

/**
 *
 * @author Claudia
 */
public class PerfilesForm extends org.apache.struts.action.ActionForm {

    private String nombre;
    private String apellido;
    private String codigo_perfil;
    private String userId;
    private FormFile theFile;


  public FormFile getTheFile() {
  return theFile;
  }

  public void setTheFile(FormFile theFile) {
  this.theFile = theFile;
  }

     public String getUserId() {
        return userId;
    }

     //  codigo perfil  u userId llegan null al otro lado

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getCodigo_perfil() {
        return codigo_perfil;
    }

    public void setCodigo_perfil(String codigo_perfil) {
        this.codigo_perfil = codigo_perfil;
    }



    public String getApellido() {
        return apellido;
    }

    public void setApellido(String apellido) {
        this.apellido = apellido;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    
    public PerfilesForm() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
     * This is the action called from the Struts framework.
     * @param mapping The ActionMapping used to select this instance.
     * @param request The HTTP Request we are processing.
     * @return
     */
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
        if (getNombre() == null || getNombre().length() < 1 || getNombre().length() > 15 ) {
            errors.add("PNombre", new ActionMessage("error.PNombre"));
          }
        if (getApellido() == null || getApellido().length() < 1 || getApellido().length() > 15 ) {
            errors.add("PApellido", new ActionMessage("error.PApellido"));
          }
        return errors;
    }
}
